# ruby encoding: utf-8

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

# Seed users

NguoiDung.create({
  ten_hien_thi: "Hiếu Lê",
  email: "letrunghieu.cse09@gmail.com",
  is_admin: true,
  mat_khau_hash: Digest::SHA1.hexdigest("admin890")
})

for i in 1..30 do
  NguoiDung.create({
    ten_hien_thi: "Nhân viên " + i.to_s,
    email: "email_nhan_vien_#{i}@qcafe.com",
    is_nhan_vien: true,
    mat_khau_hash: Digest::SHA1.hexdigest("admin890")
  })
end


# seed danh muc
DanhMuc.create({
  :loai_danh_muc  => 'san_pham',
  :slug   => 'ca_phe',
  :danh_muc_ngon_ngus => [
    DanhMucNgonNgu.new({:ngon_ngu => "vi", :ten => "Cà phê"}),
    DanhMucNgonNgu.new({:ngon_ngu => "en", :ten => "Coffee"})
  ]
})

DanhMuc.create({
  :loai_danh_muc  => 'san_pham',
  :slug   => 'giai_khat',
  :danh_muc_ngon_ngus => [
    DanhMucNgonNgu.new({:ngon_ngu => "vi", :ten => "Giải khát"}),
    DanhMucNgonNgu.new({:ngon_ngu => "en", :ten => "Beverages"})
  ]
})


DanhMuc.create({
  :loai_danh_muc  => 'san_pham',
  :slug   => 'thuc_an_nhe',
  :danh_muc_ngon_ngus => [
    DanhMucNgonNgu.new({:ngon_ngu => "vi", :ten => "Thức ăn nhẹ"}),
    DanhMucNgonNgu.new({:ngon_ngu => "en", :ten => "Snacks"})
  ]
})


DanhMuc.create({
  :loai_danh_muc  => 'bai_viet',
  :slug   => 'blog_ca_phe',
  :danh_muc_ngon_ngus => [
    DanhMucNgonNgu.new({:ngon_ngu => "vi", :ten => "Blog cà phê"}),
    DanhMucNgonNgu.new({:ngon_ngu => "en", :ten => "Coffee blog"})
  ]
})

DanhMuc.create({
  :loai_danh_muc  => 'bai_viet',
  :slug   => 'tin_qcafe',
  :danh_muc_ngon_ngus => [
    DanhMucNgonNgu.new({:ngon_ngu => "vi", :ten => "Tin QCafe"}),
    DanhMucNgonNgu.new({:ngon_ngu => "en", :ten => "QCafe News"})
  ]
})

